﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HookupAppForm.Draw
{
    /// <summary>
    /// UC_LineEdit.xaml 的交互逻辑
    /// </summary>
    public partial class UC_LineEdit : Window
    {
        internal string str_split = "";
        internal string str_sign = "";     
        internal bool saveOK = false;


        public UC_LineEdit(string str_split_p, string str_sign_p)
        {
            InitializeComponent();
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            str_split = str_split_p;
            str_sign = str_sign_p;

            tb_split.Text = str_split;
            tb_sign.Text = str_sign;
        }
 
        private void btn_confirm(object sender, RoutedEventArgs e)
        {
            //数量是否一直
            var arr_split = tb_split.Text.Split(',');
            var arr_sign = tb_sign.Text.Split(',');
            if (arr_split.Length != arr_sign.Length - 1)
            {
                MessageBox.Show("轴线间距 和 轴位标记 数量 不匹配！请更正！");
                return;
            }
            str_split = tb_split.Text;
            str_sign = tb_sign.Text;
            saveOK = true;
            Close();
        }
       
        private void tb_split_TextChanged(object sender, TextChangedEventArgs e)
        {
            tbCount1.Text = tb_split.Text.Split(',').Length + "个";
        }

        private void tb_sign_TextChanged(object sender, TextChangedEventArgs e)
        {
            tbCount2.Text = tb_sign.Text.Split(',').Length + "个";
        }
    }
}
